﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace EQual.MainModule.Employees.DetailsViews
{
    /// <summary>
    /// Interaction logic for EmployeeDistributionView.xaml
    /// </summary>
    public partial class EmployeeDistributionView : UserControl ,EQual .Infrastructure .MVPFramework .Views .IListView <DataAccesLayer .Document ,object >
    {
        public EmployeeDistributionView()
        {
            InitializeComponent();
        }

        private void dataGrid_RowEditEnding(object sender, Microsoft.Windows.Controls.DataGridRowEditEndingEventArgs e)
        {
            ItemAdded(this, new Microsoft.Practices.Composite.Events.DataEventArgs<DataAccesLayer.Document >(ActiveItem));

        }

        #region IListView<Document,object> Members

        public object Model
        {
            get
            {
                throw new NotImplementedException();
                //return this.DataContext;
            }
            set
            {
               // this.datagrid .ItemsSource   = value as System.Collections .IEnumerable ;
                this.DataContext = value;
            }
        }

        public event EventHandler<Microsoft.Practices.Composite.Events.DataEventArgs<DataAccesLayer.Document>> ItemSelected;

        public event EventHandler<Microsoft.Practices.Composite.Events.DataEventArgs<DataAccesLayer.Document>> ItemDeleted;

        public event EventHandler<Microsoft.Practices.Composite.Events.DataEventArgs<DataAccesLayer.Document>> ItemAdded;

        #endregion

        public DataAccesLayer.Document  ActiveItem
        {
            get { return datagrid . SelectedItem as DataAccesLayer.Document ; }
        }
    }
}
